﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ProjectFitus.Models.ArticleAndCategoriesModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Brjostagjof.is | Greinar
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript" src="../../Scripts/ArticleSearch.js"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="search-area">
        <h2>Greinaleit</h2>
        <input type="text" id="searchText" name="searchText" /><input type="button" id="searchButton" value="Leit" />
        <hr />
    </div>
    <h2>Flokkar</h2>
    <div id="ArticleCategoryList">
        <% Html.RenderPartial("CategoryList", Model.catsModel); %>
    </div>
    <hr />
    <h2>Greinar</h2>
    <div id="ArticleList">
    <% foreach (var item in Model.artModel) 
    { %>
        <div id="ArticleBox">
        <%= Html.ActionLink(item.title, "Details", new { id = item.id })%>
        <p>
        <%= Server.HtmlDecode(item.introText) %>
        </p>
        <% if (User.IsInRole("Administrators"))
           { %>
                <p>
                <%= Html.ActionLink("Breyta", "Edit", new { id=item.id })%> |
                <%= Html.ActionLink("Eyða", "Delete", new { id=item.id })%>
                </p>
        <% } %>
        </div>
    <%} %>
    </div> 
    <div id="ArticleSearch">
    </div>
    <script id="authorListTemplate" type="text/x-jquery-tmpl">
    <div id="ArticleBox">
        <a href="/Article/Details/${id}">${title}</a><br/>
        <p>${introText}</p>
    </div>
    </script>   
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="SideContent" runat="server">
</asp:Content>
